And it "enhances" the following underlying shell commands:
CD
ΓòÉΓòÉΓòÉ 1.5.1. ALIAS ΓòÉΓòÉΓòÉ
The ALIAS command is used to view/define/remove aliases. Alias names ARE
case-sensitive. Recursives aliases are not allowed (but an alias can use
another alias). And an alias can use all CmdShl's internal commands.
ALIAS ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇLISTΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇ@fileΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
ΓööΓöÇalias=Γö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼Γöÿ
ΓööΓöÇvalueΓöÇΓöÿ
To view all defined aliases, issue the "ALIAS LIST" command.
To save all defined aliases in a file, redirect the previous command output
into a file, as in "ALIAS LIST >mylist".
To load an alias list, use "ALIAS @mylist" (where "mylist" is a file containing
alias definitions).
To remove an existing alias, use an empty definition, as in "ALIAS foo=".
To define a new alias, use "ALIAS alias=def", where "alias" is the alias name,
and "def" its definition (any valid command). In addition, you can use the
"%*" parameter as well as "%n" (where n is the argument number in range 0..9, 0
being the alias name), which denotes "runtime" parameters. (If "%n" is
immediately followed by '*', it means "arg n and all remaining args".) Here
are some aliases definitions:
ALIAS dir=dir %* ^| less
ALIAS prj=cd \user\alpha\smith\MyProject\Current
ALIAS makeprj=prj ^& nmake
ALIAS calc=rx say %*; RC=0
ALIAS in=cd %1 ^& %2* ^& cd -
Notes:
An alias can redefine an existing command, as "dir" in the previous list. The
right-hand-side "dir" is the CMD.EXE internal command -- recursive aliases are
not allowed, and hence this second "dir" cannot be an alias, so it must be
something else (a CMD.EXE internal command in this very case).
When defining aliases from the command line, you may have to quote special
symbols (such as '&' and '|') with a '^' in order to prevent unexpected
results. For example, the first (dir), third (makeprj) and last (in) aliases
require an '^' in front of their '&'s when entered from the command line.
ΓòÉΓòÉΓòÉ 1.5.2. DEFine ΓòÉΓòÉΓòÉ
The DEFine command is used to [re]define a key. You can either assign to a key
an internal action, an immediate command or a static text. You can also remove
a key definition (the key will then returns its default value).
The CD command now accepts a new parameter, "-", and uses the CDPATH
environment variable. Additionaly, both "\" and "/" can be used in directories
specifications and the drive is changed.
CD ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
Γö£ΓöÇΓöÇdirectoryΓöÇΓöÇΓöñ
ΓööΓöÇΓöÇΓöÇΓöÇΓöÇ - ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
The CDPATH environment variable contains a list of paths. You don't have to
include the current (".") directory in it. It is always looked up first.
For example, if CDPATH is defined as:
SET CDPATH=C:\;C:\OS2;
Issuing the "CD APPS" command will bring you to "C:\OS2\APPS" (if there was no
APPS entry in the then-current directory).
WarningIf you want to switch to a directory named "-", you'll have to enclose
it with double quotes or preceed it with ".\" as in:
CD "-"
CD .\-
ΓòÉΓòÉΓòÉ 1.6. Known Limitations ΓòÉΓòÉΓòÉ
When using CmdShl as a CMD.EXE front-end, interrupting the execution of a
CMD.EXE internal command abort CmdShl too. Not much can be done regarding this
problem except waiting for a new CMD.EXE with a better signal handling...
When using CmdShl as a CMD.EXE front-end with OS/2 2.x, your command-line
window may not close upon shutdown. THIS PROBLEM NO LONGER OCCURS WITH WARP.
Alias names ARE case-sensitive. This is intentional but if you don't like it
that way, please, let me know!
If you want to switch to a directory named "-", you'll have to enclose it with
double quotes or preceed it with ".\" as in:
CD "-"
CD .\-
When using the FOR command, use two "%" sign, as in:
FOR %%n IN (foo bar) DO ECHO %%n
A directory name takes the precedence over an executable name with no
arguments. That is, if "foo" is a subdirectory of the current directory and
there also exists a "foo.exe" somewhere along the PATH, issuing the "foo"
command will change the current directory. If you want to call "foo.exe",
either use some arguments, or specify the file's extension, as in:
foo bar
foo.exe
CmdShl aliases and so-called "internal commands" (i.e., ALIAS, RX, QUIT and
DEFine) can not be used in subexpressions. That is, in:
for %%i in (foo bar) do alias do_%i=baz %i
or
(foo prj & bar prj) >foobar.log
CmdShl's ALIAS command is not called in the first statement, and foo and bar
cannot be aliases.
ΓòÉΓòÉΓòÉ 1.7. Related Files ΓòÉΓòÉΓòÉ
cdir.cmd
This filter puts colo[u]rs in your "dir" outputs. It can be used in an alias:
alias dir=dir %* | cdir
df.cmd [drive ...]
This is a unix "df" clone. It displays all available (or specified) drives,
with their total, used and free capacity.
pushd.cmd [new dir]
This command pushes the current directory in a "directory stack", and
(optionally) changes to the given disk/directory.
popd.cmd
This command pops the head of the directory stack, and go to this new
directory.
ΓòÉΓòÉΓòÉ 1.8. National Language Support ΓòÉΓòÉΓòÉ
There's just four language-dependent messages which are not automatically
adjusted: it's the alias command help string (aliasHelp), the CmdShl help
string (cmdHelp), the define command help string (defHelp) and the additional
CD help string (cdHelp). It's at the beginning of the file, and you can
translate it. Or, even better, you can define them in your PROFILE.SHL (see
below).
All other language-dependent messages are automatically adjusted by CmdShl
(secondary prompt, top of screen help string, ...).
ΓòÉΓòÉΓòÉ 1.9. Profile Support ΓòÉΓòÉΓòÉ
CmdShl supports profile files. By default, PROFILE.SHL is used, but you can
override it via the /P switch.
If present, the profile file should be somewhere along the DPATH, or you can
alternatively specify its complete path.
A profile file is a plain REXX file. It's called after command line arguments,
but before any user interaction. It's usually used to redefine keys
assignments, displaying or setting some session- dependant data, and so on...
Please refer to PROFILE1.SHL for more explanations.
ΓòÉΓòÉΓòÉ 1.9.1. PROFILE1.SHL ΓòÉΓòÉΓòÉ
This is a sample profile file for CmdShl. [Hint: for better startup
performances, you can remove all comments -- that is, all except the first.]
/* profile.shl - Emacs bindings 960202 */
/* This profile file demonstrates typical profile usage: */
/* */
/* - simulating another product, by defining new keys */
/* defining key value - a shifted key can use "-" or "_" in its name */
'DEFINE C-A home'
'DEFINE C-B left'
'DEFINE C-F right'
'DEFINE C-E end'
'DEFINE C-N cdown'
'DEFINE F3 OSNOWAIT EXIT'
/* you can even do complex things: */
'DEFINE ( OSNOWAIT RX line = insert("()",line,currOfs); currOfs = currOfs+1'
'DEFINE F8 OSNOWAIT RX line = insert(date(),line,currOfs); currOfs = currOfs+length(date())'
'DEFINE S-F7 osn rx if currTab \= 0 then do; say; do i = 1 to tree.0; say tree.i; end; call charout, print(); oline=""; parse value SysCurPos() with origRow origCol .; key="tab"; end'
/* we can even add a new feature: loading/saving commands history */
/* first, we define a file name (and make it public, F7 requires it): */
history = 'd:\tmp\history.shl'; global = global 'history'
/* then, an alias, LOADHIST, which loads the commands history */
'ALIAS LOADHIST=RX drop prevLine.; i = 0; do while lines(history); i = i+1; prevLine.i = linein(history); end; prevLine.0 = i; call stream history, "c", "close"'
/* now, we define three function keys, F2 (save), F5 (load/refresh) */
/* and F7 (name) */
'DEFINE F2 OSNOWAIT RX "@del /f" history; do i = 1 to prevLine.0; call lineout history, prevLine.i; end; call stream history, "c", "close"'